<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import= "com.roadmap.struts.action.ActionConst"%>
<%@page import="com.roadmap.common.RdcResourceBundle"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%
String user_req_id = (String)request.getParameter(ActionConst.Aspirant_Id_In_Request);
if(user_req_id == null){
	user_req_id = "";
}
boolean isHost = request.getAttribute(ActionConst.Visitor_Is_Owner) != null;
%>
			<logic:present name="personalStateForm">
			<div class="base-state">
				<table class="state-table">
					<logic:equal name="personalStateForm" property="hasVision" value="false">
					<tr><td class="name-td">您还没有规划远景，赶快<a href="vision.do?act=view&v=edit&uid=<%=user_req_id %>" >创建</a>一个吧！</td></tr>
					</logic:equal>
										 
					<logic:equal name="personalStateForm" property="hasAvailableGoal" value="false">
					<tr><td class="name-td">您还没有可执行的目标，赶快<a href="goal.do?act=create" >创建</a>一个吧！</td></tr>
					</logic:equal>
					
					<logic:equal name="personalStateForm" property="hasAvailableTask" value="false">
					<tr><td class="name-td">您还没有可执行的任务，赶快<a href="task.do?act=create" >创建</a>一个吧！</td></tr>
					</logic:equal>					
				</table>
			</div>
			</logic:present>
			
			<logic:present name="<%=ActionConst.Visitor_Is_Owner %>">
			<!-- this part can only be viewed by the information owner -->
			<logic:present name="tasks">
			<div class="exec-task">
				<div class="task-list">	
					<table cellspacing="10px" class="state-table" onmousemove="RDC.gui.display('taskMgr');" onmouseout="RDC.gui.hide('taskMgr');">
						<tr><th class="prompt" colspan="2">今天你执行了吗？</th></tr>
						<tr><td colspan="2"></td></tr>
						<tr><td align="right">选择任务：</td>
							<td align="left">
								<select class="select" style="width:400px;" name="taskList" onchange="showTask();">
									<option value="0">请选择一个任务</option>
									<logic:iterate id="task" name="tasks">
										<option value="<bean:write name='task' property="id"/>"><bean:write name='task' property="whatItIs"/></option>
									</logic:iterate>
								</select>
							</td>
						</tr>						
					</table>
				</div>
				
				<div id="task-exec" class="task-div">	
					<table class="state-table">
						<tr>							
							<td class="name-td"><a name="execTaskLink" href="javascript:void(0);" ><span id="taskContent"></span></a></td>
							<td class="state-td"><span id="taskStatus"></span></td>
							<td class="progress-td"><span id="taskProgress"></span></td>	
							<td class="state-td2"><span id="taskSymptom"></span></td>
						</tr>
					</table>
					
					<table class="state-table">						
						<tr>
							<th colspan="6" class="state-title">
								<span style="margin-right:10px">添加执行记录</span><span id="execMsg" class="prompt-message"></span>
							</th>
						</tr>
						<tr><td ><input type="hidden" name="userid" value="<%=user_req_id%>"/><input type="hidden" name="taskId"/></td></tr>
						<tr>							
							<td class="row-name">执行内容</td>
							<td align="left" colspan="5"><textarea id="content" class="input-text" name="execContent" 
								style="width:400px;height:55px;" title="执行内容(1~200)"></textarea></td>
						</tr>
						<tr>
							<td class="row-name">执行日期</td>
							<td align="left" width="60px"><input id="executeDate" class="shortDate" type="text" title="执行日期(yyyy-MM-dd)" 
																name="execDate" maxlength="10" onfocus="datePicker.showWith(this);"/></td>
							<td class="row-name">执行时长</td>
							<td align="left"><input id="executeTimeLength" class="input-text" type="text" title="执行时长(1~24)" 
																name="execTimeLength" size="4" maxlength="3" />小时</td>
							<td class="row-name">占任务比重</td>
							<td align="left"><input id="proportionOfTask" class="input-text" type="text" title="占任务比重(1~100)" 
																name="execPorp" size="4" maxlength="3"/><span>%</span></td>
						</tr>
						<tr>
							<td colspan="6" align="center" style="padding-top: 10px;">
								<input type="button" name="saveExecBtn" class="confirmBtn" value="保存" onclick="saveExec();"/>
								<input type="button" class="cancelBtn" value="取消" onclick="RDC.gui.hide('task-exec');$('taskList').value='0';"/>								
							</td>
						</tr>
					</table>
				</div>
			</div> <!-- <div class="exec-task"> -->
			</logic:present>
			</logic:present>
			
			<div class="state-detail">
				<table class="state-table" id="fpntable">
					<tr><th colspan="4" class="state-title">可执行的目标</th></tr>
				
					<logic:present name="goals">
					<tbody id="executableGoals">
					<logic:iterate id="goal" name="goals">
					<bean:define id="fpnid" name='goal' property='id'></bean:define>
					<bean:define id="fpnstatus" name='goal' property='status'></bean:define>
					<tr id="<%=fpnid %>" onmouseover="showGoalDetails(this.id);">
						<td class="name-td">
							<input type="hidden" name="pid<%=fpnid %>" value="<%=fpnid %>"/>
							<input type="hidden" name="pnm<%=fpnid %>" value="<bean:write name='goal' property='name'/>"/>
							<input type="hidden" name="gid<%=fpnid %>" value="<bean:write name='goal' property='id'/>"/>
							<input type="hidden" name="gnm<%=fpnid %>" value="<bean:write name='goal' property='name'/>"/>
							<input type="hidden" name="tcn<%=fpnid %>" value="<bean:write name='goal' property='taskCount'/>"/>
							<input type="hidden" name="pssd<%=fpnid %>" value="<bean:write format='yyyy-MM-dd' name='goal' property='scheduledStartDate'/>"/>
							<input type="hidden" name="psed<%=fpnid %>" value="<bean:write format='yyyy-MM-dd' name='goal' property='scheduledEndDate'/>"/>
							<input type="hidden" name="prsd<%=fpnid %>" value="<bean:write format='yyyy-MM-dd' name='goal' property='realStartDate'/>"/>
							<input type="hidden" name="pred<%=fpnid %>" value="<bean:write format='yyyy-MM-dd' name='goal' property='realEndDate'/>"/>
							
							<a href="goal.do?act=view&uid=<%=user_req_id%>&id=<%=fpnid %>" ><bean:write name="goal" property="whatItIs"/></a>
						</td>
						<td class="state-td" id="eps<%=fpnid %>"><%=RdcResourceBundle.LIFEGOAL_STATUS_DESCRIPTIONS[(Integer)fpnstatus]%></td>
						<td class="progress-td" id="epp<%=fpnid %>"><bean:write name="goal" property="progress"/>%</td>
						<td class="state-td2" id="epy<%=fpnid %>"><bean:write name="goal" property="symptom"/></td>
					</tr>
					</logic:iterate>
					</tbody>
					</logic:present>
				</table>
				
				<table id="goalDetails" class="entryDetails">
					<tr>
						<td class="td1">目标名称:</td><td colspan="3" class="td2" id="pd_cotent"></td>
					</tr>
					<tr>
						<td class="td1">任务数:</td><td class="td2" colspan="3"><span id='pd_execount'></span> 
						(<a id='pd_tasklink' href='task.do'>查看</a> <%if(isHost) {%>| <a id='pd_addtask' href='javascript:void(0);'>创建任务</a><%} %>)</td>
					</tr>
					<tr>
						<td class="td1">预定开始时间:</td><td id='pd_ssd' class="td2"></td>
						<td class="td1">预定结束时间:</td><td id='pd_sed' class="td2"></td>
					</tr>
					<tr>
						<td class="td1">实际开始日期:</td><td id='pd_rsd' class="td2"></td>
						<td class="td1">实际结束日期:</td><td id='pd_red' class="td2"></td>
					</tr>
				</table>
			</div>
			
			<div class="state-detail">
				<table class="state-table" id="ftktable">
					<thead><tr><th colspan="4" class="state-title">可执行的任务</th></tr></thead>
					
					<logic:present name="tasks">
					<tbody id="executableTasks">
						<logic:iterate id="task" name="tasks">
						<bean:define id="ftkid" name='task' property='id'></bean:define>
						<bean:define id="state" name='task' property='status'></bean:define>
						<bean:define id="rank" name='task' property='taskRank'></bean:define>
						<tr id="<%=ftkid %>" onmouseover="showTaskDetails(this.id);">
							<td class="name-td">
								<input type="hidden" name="tid<%=ftkid %>" value="<%=ftkid %>"/>
								<input type="hidden" name="goalId<%=ftkid %>" value="<bean:write name='task' property='goalId'/>"/>
								<input type="hidden" name="goalName<%=ftkid %>" value="<bean:write name='task' property='goalName'/>"/>
								<input type="hidden" name="trank<%=ftkid %>" value="<%=RdcResourceBundle.LIFETASK_RNAK_DESCRIPTIONS[((Integer)rank).intValue()] %>"/>
								<input type="hidden" name="tprop<%=ftkid %>" value="<bean:write name='task' property='proportionOfGoal'/>"/>
								<input type="hidden" name="lastest<%=ftkid %>" value="<bean:write format="yyyy-MM-dd HH:dd:ss" name='task' property='latestExecDate'/>"/>
								<input type="hidden" name="total<%=ftkid %>" value="<bean:write name='task' property='tatalExecTime'/>"/>
								<input type="hidden" name="count<%=ftkid %>" value="<bean:write name='task' property='execCount'/>"/>
								<input type="hidden" name="tssd<%=ftkid %>" value="<bean:write format="yyyy-MM-dd HH:dd" name='task' property='scheduledStartDate'/>"/>
								<input type="hidden" name="tsed<%=ftkid %>" value="<bean:write format="yyyy-MM-dd HH:dd" name='task' property='scheduledEndDate'/>"/>
								<input type="hidden" name="trsd<%=ftkid %>" value="<bean:write format="yyyy-MM-dd" name='task' property='realStartDate'/>"/>
								<input type="hidden" name="tred<%=ftkid %>" value="<bean:write format="yyyy-MM-dd" name='task' property='realEndDate'/>"/>
								<input type="hidden" name="tcnt<%=ftkid %>" value="<bean:write name='task' property='content'/>"/>
								
								<a href="task.do?act=view&uid=<%=user_req_id%>&id=<%=ftkid %>" >
									<span id="etn<%=ftkid %>"><bean:write name="task" property="whatItIs"/></span></a>
							</td>
							<td class="state-td" id="ets<%=ftkid %>"><%=RdcResourceBundle.LIFETASK_STATUS_DESCRIPTIONS[((Integer)state).intValue()] %></td>
							<td class="progress-td" id="etp<%=ftkid %>"><bean:write name="task" property="progress"/>%</td>
							<td class="state-td2" id="ety<%=ftkid %>"><bean:write name="task" property="symptom"/></td>
						</tr>
						</logic:iterate>
					</tbody>
					</logic:present>
				</table>
				
				<table id="taskDetails" class="entryDetails">
					<tr>
						<td class="td1">所属目标:</td><td colspan="3" class="td2"><a id="td_goal" href='goal.do?uid=&id='></a></td>
					</tr>
					<tr>
						<td class="td1">占目标比重:</td><td class="td2"><span id='td_proportion'></span>%</td>
						<td class="td1">任务等级:</td><td id='td_rank' class="td2"></td>
					</tr>
					<tr>
						<td class="td1">执行记录数:</td><td class="td2"><span id='td_execount'></span> 
							(<a id='td_execlink' href='exec.do?uid=&pid='>查看</a> <%if(isHost) {%>| <a id='td_addexec' href='javascript:void(0);'>添加执行</a><%} %>)</td>
						<td class="td1">最近执行记录:</td><td id='td_newexec' class="td2"></td>
					</tr>
					<tr>
						<td class="td1">预定开始时间:</td><td id='td_ssd' class="td2"></td>
						<td class="td1">预定结束时间:</td><td id='td_sed' class="td2"></td>
					</tr>
					<tr>
						<td class="td1">实际开始日期:</td><td id='td_rsd' class="td2"></td>
						<td class="td1">实际结束日期:</td><td id='td_red' class="td2"></td>
					</tr>
					<tr><td class="td1">任务内容:</td>	<td colspan="3" class="td2" id="td_cotent"></td></tr>
				</table>
			</div>

